package core;

/**
 * Represents a participant in a game. <code>Player</code>s can own zero or more
 * <code>Zone</code>s.
 */
public class Player extends GameObject
{
	/**
	 * Create a Player object.
	 * @param name A descriptive name for the Player.
	 */
	public Player(String name) {
		super(name);
		childrens.add(java.util.Collections.unmodifiableList(zones));
	}

	/**
	 * Add a Zone to this Player. This does not do anything special in terms
	 * of permissions: any Client can manipulate any Zone, regardless of who
	 * "owns" that Zone.
	 * @param zone The Zone to be added to this Player.
	 * @return The Zone that was added to this Player.
	 */
	public Zone addZone(Zone zone) {
		zones.add(zone);
		return zone;
	}

	/**
	 * Returns a list of Zones that this player owns. 
	 */
	public java.util.List<Zone> getZones() {
		return java.util.Collections.unmodifiableList(zones);
	}

	private final java.util.List<Zone> zones = new java.util.LinkedList<Zone>();
}